//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package zmee.sso;

import kd.bos.coderule.api.CodeRuleInfo;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.OrmLocaleValue;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.workflow.MessageCenterServiceHelper;
import kd.bos.servicehelper.workflow.WorkflowServiceHelper;
import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler;
import kd.bos.workflow.engine.msg.ctx.MessageContext;
import kd.bos.workflow.engine.msg.info.MessageInfo;
import kd.bos.workflow.engine.msg.info.ToDoInfo;
import net.sf.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class YSOAMessageServiceHandler extends AbstractMessageServiceHandler {
    private static Log logger = LogFactory.getLog(YSOAMessageServiceHandler.class);
    private String serverurl = "";
    private String url = "http://oa.wzgroup.cn/services/FrontWorkflowService";

    public YSOAMessageServiceHandler() {
    }

    public String getServerurl() {
        return this.serverurl;
    }

    public void sendMessage(MessageContext ctx, MessageInfo message) {

        logger.info("sendMessage入参 ctx:" + ctx);
        logger.info("sendMessage入参 message:" + message);
        String businessKey;
        String entityNumber;
        if (ctx != null) {
            businessKey = ctx.getBusinessKey();
            entityNumber = ctx.getEntityNumber();
        } else {
            String messageContext = (String) message.getParams().get("messageContext");
            // 将请求转换为json对象
            json.JSONObject parse = json.JSONObject.parseObject(messageContext);
            businessKey = parse.getString("businessKey");
            entityNumber = parse.getString("entityNumber");
        }


        logger.info("sendmessage-businessKey：{},entityNumber:{}",businessKey,entityNumber);
        //获取单据对象
        DynamicObject billDy = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
        logger.info("billDy:" + billDy);

        JSONObject requestJson = new JSONObject();
        String requestJsonStr="";
        String returnResultStr = "";
        String operResult="";
        String returnMessage="";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = "";
        //获取消息渠道待办接口地址
        DynamicObject dynobj= BusinessDataServiceHelper.loadSingle(getConfig().getId(), "msg_channel","zmee_createtodo");
        //流程实例ID
        String flowid = message.getId().toString();
//        String flowid = "FNA"+ctx.getProcessInstanceId();
        logger.info("flowid:"+flowid);
        //代办人员用户名集合
        List<Long> userIds = message.getUserIds();
        List<String> userNames = YSCommonUtil.getSelectColumByIds("bos_user","username",userIds);
        String receivers=userNames.toString().replace("[","").replace("]","").replace(" ","");
        //增加对jinxiaodie的过滤，如果是jinxiaodie则不发送消息
        if(StringUtils.equals(receivers,"jinxiaodie")){
            return;
        }
        //待办发起人集合
        List<Long> startUserIds = new ArrayList<Long>();
        startUserIds.add(message.getUserIds().get(0));
        String creatorIds=startUserIds.get(0).toString();
        //发起人用户名
        List<String> creatorNames= YSCommonUtil.getSelectColumByIds("bos_user","username",startUserIds);
        String creators=creatorNames.get(0).replace("[","").replace("]","");
        //发起人姓名
        List<String> Names= YSCommonUtil.getSelectColumByIds("bos_user","name",startUserIds);
        String Name=Names.get(0).replace("[","").replace("]","");
        if(dynobj != null){
            url = dynobj.getString("zmee_createtodo");
        }
        if(StringUtils.isEmpty(url)){
            writeLogByMessage(message,"sendMessage",flowid,"","消息","OA消息渠道的待办接口地址未维护，请检查维护！（路径：系统管理-消息平台-消息渠道）","","","1",receivers,"",false);
            sendErrorMessage("消息ID："+flowid+"，推送OA消息失败！！，原因："+"OA消息渠道的待办接口地址未维护，请检查并维护！（路径：系统管理-消息平台-消息渠道）",startUserIds,Name,startUserIds.get(0),message.getEntityNumber(),message.getId());
            return;
        }

        try {
            //异构系统标识
            requestJson.put("syscode", "hn_opc");
            //流程实例id
            requestJson.put("flowid", flowid);
            //流程标题
//            String requestname = message.getTitle();
            String requestname;
            // 2023-8-28 标题取流程中单据主题
            try {
                // 根据业务单据id获取工作流流程相关属性内容
                Map<String, Object> processInstancePropertiesByBusinesskey = WorkflowServiceHelper.getProcessInstancePropertiesByBusinesskey(businessKey);
                // 获取流程主题
                Object subject = processInstancePropertiesByBusinesskey.get("subject");
                // 由于流程主题是多语言文本 所以去本地值
                String localeValue = ((OrmLocaleValue) subject).getLocaleValue();
                logger.info("localeValue:" + localeValue);
                if (StringUtils.isEmpty(localeValue)) {
                    requestname = message.getTitle();
                    logger.info("sendmessage-requestname:localeValue为空");
                } else {
                    requestname = localeValue;
                    logger.info("sendmessage-requestname:localeValue不为空");
                }
            } catch (Exception e) {
                requestname = message.getTitle();
                logger.info("sendmessage-requestname:异常");
            }
            //流程类型名称
            if(entityNumber.equals("src_bidopen")){
                requestname = billDy.getString("bidname");
            }
            requestJson.put("requestname", requestname);

            requestJson.put("workflowname", "优采云待办");
            //节点名称
            requestJson.put("nodename","消息");
            //PC地址
            requestJson.put("pcurl", message.getContentUrl()+"&flowid="+flowid + "&messagetype=sendMessage");
            logger.info("sendmessage url:"+message.getContentUrl());
            //APP地址
            String appurl_g = message.getContentUrl().replace("https://opc.zmeeol.com","");
            requestJson.put("appurl", appurl_g + "&device=mob");


            //流程处理状态  8：抄送（待阅）
            requestJson.put("isremark", "8");
            //流程查看状态  0：未读
            requestJson.put("viewtype", "1");
            //创建人
            requestJson.put("creator",creators);
            //创建时间
            String createdatetime=simpleDateFormat.format(message.getSendTime());
            requestJson.put("createdatetime", createdatetime);
            //接收人账号
            requestJson.put("receiver", receivers);
            //接收时间
            requestJson.put("receivedatetime", createdatetime);
            //时间戳字段
            requestJson.put("receivets", String.valueOf(System.currentTimeMillis()));
            logger.info("抄送：requestJson:"+requestJson.toString());

            logger.info("sendMessage调用接口的url：" + url + "\nsendMessage调用接口的参数：\n" + requestJson);

            String returnResult = postData2ofs(url,requestJson.toString()); //调用OA接口
            if(returnResult==null||StringUtils.equals("",returnResult)){
                //tryAgainByMessage(message,"sendMessage",flowid,"","消息",startUserIds,Name,creatorIds,receivers,requestJson,url);
                return;
            }
            requestJsonStr=requestJson.toString();
            JSONObject returnResultObj=JSONObject.fromObject(returnResult);
            returnResultStr=returnResult.toString();

            logger.info("sendMessage调用接口的返回值：" + returnResult);

            //操作结果
            operResult=returnResultObj.getString("operResult");
            returnMessage=returnResultObj.getString("message");
        } catch (Exception var7) {
            //tryAgainByMessage(message,"sendMessage",flowid,"","消息",startUserIds,Name,creatorIds,receivers,requestJson,url);
        } finally {
            if (StringUtils.equals(operResult,"1")) {
                writeLogByMessage(message,"sendMessage",flowid,"","消息",returnMessage,requestJsonStr,returnResultStr,creatorIds,receivers,url,true);
            } else if(StringUtils.equals(operResult,"0")){
                writeLogByMessage(message,"sendMessage",flowid,"","消息",returnMessage,requestJsonStr,returnResultStr,creatorIds,receivers,url,false);
                sendErrorMessage("消息ID："+flowid+"，推送OA消息失败！！，原因："+returnMessage,startUserIds,Name,startUserIds.get(0),message.getEntityNumber(),message.getId());
            }

        }















//        JSONObject requestJson = new JSONObject();
//        String requestJsonStr = "";
//        String returnResultStr = "";
//        String operResult = "1";
//        String returnMessage = "";
//        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String flowid = message.getId().toString();
//        String workflowId = "214272";
//        logger.info("workflowId:" + workflowId);
//        List<Long> userIds = message.getUserIds();
//        List<String> userNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", userIds);
//        String receivers = userNames.toString().replace("[", "").replace("]", "").replace(" ", "");
//        if (!StringUtils.equals(receivers, "jinxiaodie")) {
//            List<Long> startUserIds = new ArrayList();
//            startUserIds.add(message.getUserIds().get(0));
//            String creatorIds = ((Long)startUserIds.get(0)).toString();
//            List<String> creatorNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", startUserIds);
//            String creators = ((String)creatorNames.get(0)).replace("[", "").replace("]", "");
//            List<String> Names = YSCommonUtil.getSelectColumByIds("bos_user", "name", startUserIds);
//            String Name = ((String)Names.get(0)).replace("[", "").replace("]", "");
//            if (StringUtils.isEmpty(this.url)) {
//                writeLogByMessage(message, "sendMessage", flowid, "", "消息", "OA消息渠道的待办接口地址未维护，请检查维护！（路径：系统管理-消息平台-消息渠道）", "", "", "1", receivers, "", false);
//                this.sendErrorMessage("消息ID：" + flowid + "，推送OA消息失败！！，原因：OA消息渠道的待办接口地址未维护，请检查并维护！（路径：系统管理-消息平台-消息渠道）", startUserIds, Name, (Long)startUserIds.get(0), message.getEntityNumber(), message.getId());
//            } else {
//                String oamessage = "";
//                String returnResult = "";
//                String request = "";
//
//                try {
//                    String requestname = message.getTitle();
//                    oamessage = this.postmessage(requestname, "sysyw", receivers, "109272");
//                    logger.info("ces-oamessage:" + oamessage);
//                    requestJson.put("", oamessage);
//                    returnResult = this.sendOA(oamessage, this.url);
//                    logger.info("ces-returnResult:" + returnResult);
//                    request = "title：" + message.getTitle() + "发送人：sysyw接收人：" + receivers + "workflowid:" + workflowId;
//                    if (returnResult != null && !StringUtils.equals("", returnResult)) {
//                        return;
//                    }
//                } catch (Exception var27) {
//                    logger.info("出错：" + var27);
//                    return;
//                } finally {
//                    logger.info("operResult:" + operResult);
//                    if (StringUtils.equals(operResult, "1")) {
//                        writeLogByMessage(message, "sendMessage", flowid, "", "消息", message.getTitle(), request, returnResult, creatorIds, receivers, this.url, true);
//                    } else if (StringUtils.equals(operResult, "0")) {
//                        writeLogByMessage(message, "sendMessage", flowid, "", "消息", "", request, returnResult, creatorIds, receivers, this.url, true);
//                        this.sendErrorMessage("消息ID：" + flowid + "，推送OA消息失败！！，原因：", startUserIds, Name, (Long)startUserIds.get(0), message.getEntityNumber(), message.getId());
//                    }
//
//                }
//
//            }
//        }
    }

    @Override
    public void createToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
        JSONObject requestJson = new JSONObject();
        String requestJsonStr = "";
        String returnResultStr = "";
        String operResult = "";
        String message = "";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = "";
        DynamicObject dynobj = BusinessDataServiceHelper.loadSingle(this.getConfig().getId(), "msg_channel", "zmee_createtodo");
        String flowid = "hn_opc" + messageContext.getProcessInstanceId();
        logger.info("createToDo：flowid:" + flowid);
        List<String> businessKeys = new ArrayList();
        businessKeys.add(String.valueOf(messageContext.getBusinessKey()));
        logger.info("获取节点名称" + YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "name", businessKeys).toString());
        String nodenameStr = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "name", businessKeys).toString();
        nodenameStr = nodenameStr.replace("[", "").replace("]", "");
        String billNumber = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "billno", businessKeys).toString();
        billNumber = billNumber.replace("[", "").replace("]", "");
        List<Long> userIds = toDoInfo.getUserIds();
        List<String> userNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", userIds);
        String receivers = userNames.toString().replace("[", "").replace("]", "").replace(" ", "");
        if (!StringUtils.equals(receivers, "jinxiaodie")) {
            List<Long> startUserIds = new ArrayList();
            startUserIds.add(messageContext.getStartUserId());
            String creatorIds = ((Long)startUserIds.get(0)).toString();
            List<String> creatorNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", startUserIds);
            String creators = ((String)creatorNames.get(0)).replace("[", "").replace("]", "");
            List<String> Names = YSCommonUtil.getSelectColumByIds("bos_user", "name", startUserIds);
            String Name = ((String)Names.get(0)).replace("[", "").replace("]", "");
            if (dynobj != null) {
                url = dynobj.getString("zmee_createtodo");
            }

            if (StringUtils.isEmpty(url)) {
                writeLog(messageContext, "createToDo", flowid, billNumber, nodenameStr, "OA消息渠道的待办接口地址未维护，请检查维护！（路径：系统管理-消息平台-消息渠道）", "", "", "1", receivers, "", false);
                this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：OA消息渠道的待办接口地址未维护，请检查并维护！（路径：系统管理-消息平台-消息渠道）", startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
            } else {
                try {
                    requestJson.put("syscode", "hn_opc");
                    requestJson.put("flowid", flowid);
                    String requestname = toDoInfo.getTitle();
                    if (billNumber != null) {
                        QFilter qFilter;
                        DynamicObject gxcwf;
                        String department;
                        DynamicObject zjmi_department;
                        String istrue;
                        String pricetaxtotal;
                        int i;
                        String pNumber;
                        if (billNumber.contains("GXFKS")) {
                            qFilter = new QFilter("billno", "=", billNumber);
                            gxcwf = BusinessDataServiceHelper.loadSingle("ap_payapply", "zjmi_department,applycause,applyamount,paycurrency", new QFilter[]{qFilter});
                            if (gxcwf != null) {
                                department = "";
                                zjmi_department = gxcwf.getDynamicObject("wycy_department");
                                if (zjmi_department != null) {
                                    department = zjmi_department.getString("name");
                                }

                                istrue = gxcwf.getString("applycause");
                                pricetaxtotal = gxcwf.getString("applyamount");
                                i = pricetaxtotal.indexOf(".");
                                pNumber = pricetaxtotal.substring(0, i + 3);
                                DynamicObject paycurrency = gxcwf.getDynamicObject("paycurrency");
                                String number = paycurrency.getString("number");
                                requestJson.put("requestname", department + "-" + Name + "-" + istrue + "-" + number + pNumber + "");
                                logger.info("createToDo:requestJson:" + requestJson);
                            } else {
                                requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                            }
                        } else if (billNumber.contains("GXCWF")) {
                            qFilter = new QFilter("billno", "=", billNumber);
                            gxcwf = BusinessDataServiceHelper.loadSingle("ap_finapbill", "department,zjmi_checkboxfield,billtypeid,zjmi_applycause,pricetaxtotal,zjmi_payamountsum,currency", new QFilter[]{qFilter});
                            if (gxcwf != null) {
                                department = "";
                                zjmi_department = gxcwf.getDynamicObject("department");
                                if (zjmi_department != null) {
                                    department = zjmi_department.getString("name");
                                }

                                istrue = gxcwf.getString("zjmi_checkboxfield");
                                logger.info("createToDo:istrue" + istrue);
                                pricetaxtotal = gxcwf.getString("pricetaxtotal");
                                i = pricetaxtotal.indexOf(".");
                                pNumber = pricetaxtotal.substring(0, i + 3);
                                logger.info("createToDo:pNumber" + pNumber);
                                String zjmi_payamountsum = gxcwf.getString("zjmi_payamountsum");
                                int index = zjmi_payamountsum.indexOf(".");
                                String intNumber = zjmi_payamountsum.substring(0, index + 3);
                                logger.info("createToDo:intNumber" + intNumber);
                                DynamicObject billtypeid = gxcwf.getDynamicObject("billtypeid");
                                String name = billtypeid.getString("name");
                                logger.info("createToDo:name" + name);
                                String applycause = gxcwf.getString("zjmi_applycause");
                                logger.info("createToDo:zjmi_applycause" + applycause);
                                DynamicObject paycurrency = gxcwf.getDynamicObject("currency");
                                String number = paycurrency.getString("number");
                                if (istrue.equals("true")) {
                                    requestJson.put("requestname", department + "-" + Name + "-" + applycause + "-" + number + intNumber + "");
                                    logger.info("createToDo:requestJson:" + requestJson);
                                } else if (istrue.equals("false")) {
                                    requestJson.put("requestname", department + "-" + Name + "-" + name + "-" + number + pNumber + "");
                                    logger.info("createToDo:requestJson:" + requestJson);
                                }
                            } else {
                                requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                            }
                        } else {
                            requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                        }
                    } else {
                        requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                    }

                    // 2023-8-28 标题取流程中单据主题
                    try {
                        List<String> nodeColumnByBusinessKeys = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "subject", businessKeys);
                        if (nodeColumnByBusinessKeys == null || nodeColumnByBusinessKeys.size() == 0) {
                            logger.info("createToDo-requestname: 未找到单据主题");
                            requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                        } else {
                            logger.info("获取单据主题" + YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "subject", businessKeys).toString());
                            requestJson.put("requestname", YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "subject", businessKeys).toString());
                        }
                    } catch (Exception e) {
                        logger.info("createToDo-requestname:异常");
                        requestJson.put("requestname", requestname + "，单据编号：" + billNumber + "");
                    }

                    requestJson.put("workflowname", "优采云待办");
                    requestJson.put("nodename", nodenameStr);
                    requestJson.put("pcurl", toDoInfo.getUrl());
                    logger.info("YSOAMessageServiceHandler记录移动端地址" + toDoInfo.getUrl() + "&device=mob");
                    String appurl_g = toDoInfo.getUrl().replace("https://opc.zmeeol.com","");
                    requestJson.put("appurl", appurl_g + "&device=mob");

                    //requestJson.put("appurl", toDoInfo.getUrl() + "&device=mob");
                    requestJson.put("isremark", "0");
                    requestJson.put("viewtype", "0");
                    requestJson.put("creator", creators);
                    String createdatetime = simpleDateFormat.format(new Date());
                    requestJson.put("createdatetime", createdatetime);
                    requestJson.put("receiver", receivers);
                    requestJson.put("receivedatetime", createdatetime);
                    requestJson.put("receivets", String.valueOf(System.currentTimeMillis()));

                    logger.info("createToDo调用接口的url：" + url + "\ncreateToDo调用接口的参数：\n" + requestJson);

                    String returnResult = this.postData2ofs(url, requestJson.toString());
                    if (returnResult != null && !StringUtils.equals("", returnResult)) {

                        logger.info("createToDo调用接口的返回值：" + returnResult);

                        requestJsonStr = requestJson.toString();
                        JSONObject returnResultObj = JSONObject.fromObject(returnResult);
                        returnResultStr = returnResult.toString();
                        operResult = returnResultObj.getString("operResult");
                        message = returnResultObj.getString("message");
                        return;
                    }

                    this.tryAgain(messageContext, "createToDo", flowid, billNumber, nodenameStr, startUserIds, Name, creatorIds, receivers, requestJson, url);
                } catch (Exception var44) {
                    this.tryAgain(messageContext, "createToDo", flowid, billNumber, nodenameStr, startUserIds, Name, creatorIds, receivers, requestJson, url);
                    return;
                } finally {
                    if (StringUtils.equals(operResult, "1")) {
                        writeLog(messageContext, "createToDo", flowid, billNumber, nodenameStr, message, requestJsonStr, returnResultStr, creatorIds, receivers, url, true);
                    } else if (StringUtils.equals(operResult, "0")) {
                        writeLog(messageContext, "createToDo", flowid, billNumber, nodenameStr, message, requestJsonStr, returnResultStr, creatorIds, receivers, url, false);
                        this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + message, startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    }

                }

            }
        }
    }

    @Override
    public void dealToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
        JSONObject requestJson = new JSONObject();

        JSONObject oldrequestJson = new JSONObject();
        String requestJsonStr = "";
        String returnResultStr = "";
        String operResult = "";
        String message = "";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = "";
        DynamicObject dynobj = BusinessDataServiceHelper.loadSingle(this.getConfig().getId(), "msg_channel", "zmee_dealtodo");
        String oldflowid = String.valueOf(toDoInfo.getTaskId());
        String flowid = "hn_opc" + messageContext.getProcessInstanceId();
        logger.info("dealToDo：flowid:" + flowid);
        List<String> businessKeys = new ArrayList();
        businessKeys.add(String.valueOf(messageContext.getBusinessKey()));
        String nodenameStr = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "name", businessKeys).toString();
        nodenameStr = nodenameStr.replace("[", "").replace("]", "");
        String billNumber = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "billno", businessKeys).toString();
        billNumber = billNumber.replace("[", "").replace("]", "");
        List<Long> userIds = toDoInfo.getUserIds();
        List<String> userNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", userIds);
        String receivers = userNames.toString().replace("[", "").replace("]", "").replace(" ", "");
        if (!StringUtils.equals(receivers, "jinxiaodie")) {
            List<Long> startUserIds = new ArrayList();
            startUserIds.add(messageContext.getStartUserId());
            String creatorIds = ((Long)startUserIds.get(0)).toString();
            List<String> creatorNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", startUserIds);
            String creators = ((String)creatorNames.get(0)).replace("[", "").replace("]", "");
            List<String> Names = YSCommonUtil.getSelectColumByIds("bos_user", "name", startUserIds);
            String Name = ((String)Names.get(0)).replace("[", "").replace("]", "");
            if (dynobj != null) {
                url = dynobj.getString("zmee_dealtodo");
            }

            if (StringUtils.isEmpty(url)) {
                writeLog(messageContext, "dealToDo", flowid, billNumber, nodenameStr, "OA消息渠道的已办接口地址未维护，请检查维护！（路径：系统管理-消息平台-消息渠道）", "", "", "1", receivers, "", false);
                this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：OA消息渠道的已办接口地址未维护，请检查并维护！（路径：系统管理-消息平台-消息渠道）", startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
            } else {
                try {
                    requestJson.put("syscode", "hn_opc");
                    oldrequestJson.put("syscode", "hn_opc");
                    requestJson.put("flowid", flowid);
                    oldrequestJson.put("flowid", oldflowid);
                    String requestname = toDoInfo.getTitle();
                    if (billNumber != null) {
                        QFilter qFilter;
                        DynamicObject gxcwf;
                        String department;
                        DynamicObject zjmi_department;
                        String istrue;
                        String pricetaxtotal;
                        int i;
                        String pNumber;
                        if (billNumber.contains("GXFKS")) {
                            qFilter = new QFilter("billno", "=", billNumber);
                            gxcwf = BusinessDataServiceHelper.loadSingle("ap_payapply", "zjmi_department,applycause,applyamount,paycurrency", new QFilter[]{qFilter});
                            if (gxcwf != null) {
                                department = "";
                                zjmi_department = gxcwf.getDynamicObject("zjmi_department");
                                if (zjmi_department != null) {
                                    department = zjmi_department.getString("name");
                                }

                                istrue = gxcwf.getString("applycause");
                                pricetaxtotal = gxcwf.getString("applyamount");
                                i = pricetaxtotal.indexOf(".");
                                pNumber = pricetaxtotal.substring(0, i + 3);
                                DynamicObject paycurrency = gxcwf.getDynamicObject("paycurrency");
                                String number = paycurrency.getString("number");
                                requestJson.put("requestname", department + "-" + Name + "-" + istrue + "-" + number + pNumber + "");
                                logger.info("dealToDo:requestJson:" + requestJson);
                            } else {
                                requestJson.put("requestname", "请处理" + Name + "发起的单据，单据编号：" + billNumber + "");
                            }
                        } else if (billNumber.contains("GXCWF")) {
                            qFilter = new QFilter("billno", "=", billNumber);
                            gxcwf = BusinessDataServiceHelper.loadSingle("ap_finapbill", "department,zjmi_checkboxfield,billtypeid,zjmi_applycause,pricetaxtotal,zjmi_payamountsum,currency", new QFilter[]{qFilter});
                            if (gxcwf != null) {
                                department = "";
                                zjmi_department = gxcwf.getDynamicObject("department");
                                if (zjmi_department != null) {
                                    department = zjmi_department.getString("name");
                                }

                                logger.info("dealToDo:istrue" + zjmi_department);
                                istrue = gxcwf.getString("zjmi_checkboxfield");
                                logger.info("dealToDo:istrue" + istrue);
                                pricetaxtotal = gxcwf.getString("pricetaxtotal");
                                i = pricetaxtotal.indexOf(".");
                                pNumber = pricetaxtotal.substring(0, i + 3);
                                logger.info("dealToDo:pNumber" + pNumber);
                                String zjmi_payamountsum = gxcwf.getString("zjmi_payamountsum");
                                int index = zjmi_payamountsum.indexOf(".");
                                String intNumber = zjmi_payamountsum.substring(0, index + 3);
                                logger.info("dealToDo:intNumber" + intNumber);
                                DynamicObject billtypeid = gxcwf.getDynamicObject("billtypeid");
                                String name = billtypeid.getString("name");
                                logger.info("dealToDo:name" + name);
                                String applycause = gxcwf.getString("zjmi_applycause");
                                logger.info("dealToDo:zjmi_applycause" + applycause);
                                DynamicObject paycurrency = gxcwf.getDynamicObject("currency");
                                String number = paycurrency.getString("number");
                                if (istrue.equals("true")) {
                                    requestJson.put("requestname", department + "-" + Name + "-" + applycause + "-" + number + intNumber + "");
                                    logger.info("dealToDo:requestJson:" + requestJson);
                                } else if (istrue.equals("false")) {
                                    requestJson.put("requestname", department + "-" + Name + "-" + name + "-" + number + pNumber + "");
                                    logger.info("dealToDo:requestJson:" + requestJson);
                                }
                            } else {
                                requestJson.put("requestname", "请处理" + Name + "发起的单据，单据编号：" + billNumber + "");
                            }
                        } else {
                            requestJson.put("requestname", "请处理" + Name + "发起的单据，单据编号：" + billNumber + "");
                        }
                    } else {
                        requestJson.put("requestname", "请处理" + Name + "发起的单据，单据编号：" + billNumber + "");
                    }

                    requestJson.put("workflowname", "优采云待办");
                    oldrequestJson.put("workflowname", "优采云待办");
                    requestJson.put("nodename", nodenameStr);
                    oldrequestJson.put("nodename", nodenameStr);
                    requestJson.put("pcurl", toDoInfo.getUrl());
                    oldrequestJson.put("pcurl", toDoInfo.getUrl());
                    String appurl_g = toDoInfo.getUrl().replace("https://opc.zmeeol.com","");
                    requestJson.put("appurl", appurl_g + "&device=mob");
                    oldrequestJson.put("appurl", appurl_g + "&device=mob");
                    requestJson.put("isremark", "2");
                    oldrequestJson.put("isremark", "2");
                    requestJson.put("viewtype", "0");
                    oldrequestJson.put("viewtype", "0");
                    requestJson.put("creator", creators);
                    oldrequestJson.put("creator", creators);
                    String createdatetime = simpleDateFormat.format(new Date());
                    requestJson.put("createdatetime", createdatetime);
                    oldrequestJson.put("createdatetime", createdatetime);
                    requestJson.put("receiver", receivers);
                    oldrequestJson.put("receiver", receivers);
                    requestJson.put("receivedatetime", createdatetime);
                    oldrequestJson.put("receivedatetime", createdatetime);
                    requestJson.put("receivets", String.valueOf(System.currentTimeMillis()));
                    oldrequestJson.put("receivets", String.valueOf(System.currentTimeMillis()));

                    logger.info("dealToDo调用接口的url：" + url + "\ndealToDo调用接口的参数requestJson：\n" + requestJson);
                    logger.info("dealToDo调用接口的url：" + url + "\ndealToDo调用接口的参数oldrequestJson：\n" + oldrequestJson);

                    String returnResult = this.postData2ofs(url, requestJson.toString());
                    if (returnResult == null || StringUtils.equals("", returnResult)) {
                        this.tryAgain(messageContext, "dealToDo", flowid, billNumber, nodenameStr, startUserIds, Name, creatorIds, receivers, requestJson, url);
                        return;
                    }

                    logger.info("dealToDo调用接口的返回值：" + returnResult);

                    requestJsonStr = requestJson.toString();
                    JSONObject returnResultObj = JSONObject.fromObject(returnResult);
                    returnResultStr = returnResult.toString();
                    operResult = returnResultObj.getString("operResult");
                    message = returnResultObj.getString("message");
                } catch (Exception var46) {
                    this.tryAgain(messageContext, "dealToDo", flowid, billNumber, nodenameStr, startUserIds, Name, creatorIds, receivers, requestJson, url);
                } finally {
                    if (StringUtils.equals(operResult, "1")) {
                        writeLog(messageContext, "dealToDo", flowid, billNumber, nodenameStr, message, requestJsonStr, returnResultStr, creatorIds, receivers, url, true);
                    } else if (StringUtils.equals(operResult, "0")) {
                        writeLog(messageContext, "dealToDo", flowid, billNumber, nodenameStr, message, requestJsonStr, returnResultStr, creatorIds, receivers, url, false);
                        this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + message, startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    }

                }

            }
        }
    }

    @Override
    public void deleteToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
        JSONObject requestJson = new JSONObject();
        JSONObject oldrequestJson = new JSONObject();
        String requestJsonStr = "";
        String returnResultStr = "";
        String operResult = "";
        String message = "";
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String url = "";
        DynamicObject dynobj = BusinessDataServiceHelper.loadSingle(this.getConfig().getId(), "msg_channel", "zmee_deletetodo");
        String oldflowid = String.valueOf(toDoInfo.getTaskId());
        String flowid = "hn_opc" + messageContext.getProcessInstanceId();
        logger.info("deleteToDo：flowid:" + flowid);
        List<String> businessKeys = new ArrayList();
        businessKeys.add(String.valueOf(messageContext.getBusinessKey()));
        String billNumber = YSCommonUtil.getNodeColumnByBusinessKeys("wf_task", "billno", businessKeys).toString();
        billNumber = billNumber.replace("[", "").replace("]", "");
        List<Long> userIds = toDoInfo.getUserIds();
        List<String> userNames = YSCommonUtil.getSelectColumByIds("bos_user", "username", userIds);
        String receivers = userNames.toString().replace("[", "").replace("]", "").replace(" ", "");
        List<Long> startUserIds = new ArrayList();
        startUserIds.add(Long.parseLong("1"));
        if (dynobj != null) {
            url = dynobj.getString("zmee_deletetodo");
        }

        if (StringUtils.isEmpty(url)) {
            writeLog(messageContext, "deleteToDo", flowid, "", "", "OA消息渠道的删除待办接口地址未维护，请检查维护！（路径：系统管理-消息平台-消息渠道）", "", "", "1", receivers, "", false);
            this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：OA消息渠道的删除待办接口地址未维护，请检查并维护！（路径：系统管理-消息平台-消息渠道）", startUserIds, "administrator", (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
        } else if (StringUtils.isEmpty(receivers)) {
            writeLog(messageContext, "deleteToDo", flowid, "", "", "未获取到待办接收人数据！！，toDoInfo:" + toDoInfo.toString(), "", "", "1", receivers, "", true);
            this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，删除OA待办失败！！，原因：未获取到待办接收人数据！！，toDoInfo:" + toDoInfo.toString(), startUserIds, "administrator", (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
        } else {
            String[] var20 = receivers.split(",");
            int var21 = var20.length;

            for(int var22 = 0; var22 < var21; ++var22) {
                String receiver = var20[var22];

                try {
                    if (StringUtils.equals(receiver, "jinxiaodie")) {
                        return;
                    }

                    requestJson.put("syscode", "hn_opc");
                    oldrequestJson.put("syscode", "hn_opc");
                    requestJson.put("flowid", flowid);
                    oldrequestJson.put("flowid", oldflowid);
                    requestJson.put("userid", receiver);
                    oldrequestJson.put("userid", receiver);

                    logger.info("deleteToDo调用接口的url：" + url + "\ndeleteToDo调用接口的参数：\n" + requestJson);
                    logger.info("deleteToDo调用接口的url：" + url + "\ndeleteToDo调用接口的参数：\n" + oldrequestJson);

                    String returnResult = this.postData2ofs(url, requestJson.toString());
                    if (returnResult != null && !StringUtils.equals("", returnResult)) {

                        logger.info("deleteToDo调用接口的返回值：" + returnResult);

                        requestJsonStr = requestJson.toString();
                        JSONObject returnResultObj = JSONObject.fromObject(returnResult);
                        returnResultStr = returnResult.toString();
                        operResult = returnResultObj.getString("operResult");
                        message = returnResultObj.getString("message");
                        continue;
                    }

                    this.tryAgain(messageContext, "deleteToDo", flowid, "", "", startUserIds, "administrator", "1", receivers, requestJson, url);
                } catch (Exception var29) {
                    this.tryAgain(messageContext, "deleteToDo", flowid, "", "", startUserIds, "administrator", "1", receiver, requestJson, url);
                    continue;
                } finally {
                    if (StringUtils.equals(operResult, "1")) {
                        writeLog(messageContext, "deleteToDo", flowid, "", "", message, requestJsonStr, returnResultStr, "1", receiver, url, true);
                    } else if (StringUtils.equals(operResult, "0")) {
                        writeLog(messageContext, "deleteToDo", flowid, "", "", message, requestJsonStr, returnResultStr, "1", receiver, url, false);
                        this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，删除OA待办失败！！，原因：" + message, startUserIds, "administrator", (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    }

                }

                return;
            }

        }
    }

    public String postData2ofs(String posturl, String param) {
        OutputStreamWriter out = null;
        BufferedReader in = null;
        String result = "";

        try {
            URL realUrl = new URL(this.serverurl + posturl);
            URLConnection conn = realUrl.openConnection();
            conn.setRequestProperty("accept", "*/*");
            conn.setRequestProperty("connection", "Keep-Alive");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setDoOutput(true);
            conn.setDoInput(true);
            out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
            out.write(param);
            out.flush();

            String line;
            for(in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); (line = in.readLine()) != null; result = result + line) {
            }

            JSONObject object = JSONObject.fromObject(result);
            String returnResult = object.toString();
            String var11 = returnResult;
            return var11;
        } catch (Exception var21) {
            logger.error("zmee.cloud.bos.OAMessageServiceHandler,发送 POST请求出现异常！", var21.getMessage());
        } finally {
            try {
                if (out != null) {
                    out.close();
                }

                if (in != null) {
                    in.close();
                }
            } catch (IOException var20) {
                var20.printStackTrace();
            }

        }

        return null;
    }

    private static void writeLog(MessageContext messageContext, String messagetype, String flowid, String billnumber, String nodename, String message, String request, String response, String creator, String receiver, String posturl, boolean issuccess) {
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        DynamicObject bill = BusinessDataServiceHelper.newDynamicObject("zmee_log_oapush");
        CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(bill.getDataEntityType().getName(), bill, (String)null);
        bill.set("number", CodeRuleServiceHelper.getNumber(codeRule, bill));
        bill.set("name", messagetype);
        bill.set("zmee_messagetype", messagetype);
        bill.set("zmee_flowid", flowid);
        bill.set("zmee_billnumber", billnumber);
        bill.set("zmee_billtype", messageContext.getEntityNumber());
        bill.set("zmee_nodename", nodename);
        bill.set("zmee_message", message);
        bill.set("zmee_request", request);
        bill.set("zmee_response", response);
        bill.set("status", "C");
        bill.set("enable", "1");
        bill.set("creator", creator);
        bill.set("zmee_createdate", new Date());
        bill.set("zmee_receiver", receiver);
        bill.set("zmee_receiverdate", new Date());
        bill.set("zmee_posturl", posturl);
        bill.set("zmee_issuccess", issuccess);
        SaveServiceHelper.save(new DynamicObject[]{bill});
        String as = "";
    }

    private static void writeLogByMessage(MessageInfo message, String messagetype, String flowid, String billnumber, String nodename, String returnMessage, String request, String response, String creator, String receiver, String posturl, boolean issuccess) {
        new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        DynamicObject bill = BusinessDataServiceHelper.newDynamicObject("zmee_log_oapush");
        CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(bill.getDataEntityType().getName(), bill, (String)null);
        bill.set("number", CodeRuleServiceHelper.getNumber(codeRule, bill));
        bill.set("name", messagetype);
        bill.set("zmee_messagetype", messagetype);
        bill.set("zmee_flowid", flowid);
        bill.set("zmee_billnumber", billnumber);
        bill.set("zmee_billtype", message.getEntityNumber());
        bill.set("zmee_nodename", nodename);
        bill.set("zmee_message", returnMessage);
        bill.set("zmee_request", request);
        bill.set("zmee_response", response);
        bill.set("status", "C");
        bill.set("enable", "1");
        bill.set("creator", creator);
        bill.set("zmee_createdate", new Date());
        bill.set("zmee_receiver", receiver);
        bill.set("zmee_receiverdate", new Date());
        bill.set("zmee_posturl", posturl);
        bill.set("zmee_issuccess", issuccess);
        SaveServiceHelper.save(new DynamicObject[]{bill});
        String as = "";
    }

    private void tryAgain(MessageContext messageContext, String messagetype, String flowid, String billNumber, String nodenameStr, List<Long> startUserIds, String Name, String creator, String receiver, JSONObject request, String url) {
        int count = 0;
        String returnResult = "";

        while(true) {
            try {
                returnResult = this.postData2ofs(url, request.toString());
                if (returnResult == null) {
                    ++count;
                }

                if (count == 3) {
                    writeLog(messageContext, messagetype, flowid, billNumber, nodenameStr, "接口调用异常,响应为null", request.toString(), "null", creator, receiver, url, false);
                    this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：接口调用异常,响应为null,请联系系统管理员！", startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    break;
                }

                JSONObject returnResultObj = JSONObject.fromObject(returnResult);
                if (returnResultObj.containsKey("operResult")) {
                    if (StringUtils.equals("1", returnResultObj.getString("operResult"))) {
                        writeLog(messageContext, messagetype, flowid, billNumber, nodenameStr, returnResultObj.getString("message"), request.toString(), returnResult, creator, receiver, url, true);
                    } else {
                        writeLog(messageContext, messagetype, flowid, billNumber, nodenameStr, returnResultObj.getString("message"), request.toString(), returnResult, creator, receiver, url, false);
                        this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + returnResultObj.getString("message"), startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    }
                    break;
                }
            } catch (Exception var17) {
                ++count;

                try {
                    TimeUnit.MINUTES.sleep(1L);
                } catch (InterruptedException var16) {
                    var16.printStackTrace();
                }

                if (count == 3) {
                    writeLog(messageContext, messagetype, flowid, billNumber, nodenameStr, "接口调用异常" + var17.getMessage(), request.toString(), returnResult, creator, receiver, url, false);
                    this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + var17.getMessage(), startUserIds, Name, (Long)startUserIds.get(0), messageContext.getEntityNumber(), messageContext.getTaskId());
                    break;
                }
            }
        }

    }

    private void tryAgainByMessage(MessageInfo message, String messagetype, String flowid, String billNumber, String nodenameStr, List<Long> startUserIds, String Name, String creator, String receiver, JSONObject request, String url) {
        int count = 0;
        String returnResult = "";

        while(true) {
            try {
                returnResult = this.postData2ofs(url, request.toString());
                if (returnResult == null) {
                    ++count;
                }

                if (count == 3) {
                    writeLogByMessage(message, "sendMessage", flowid, "", "消息", "接口调用异常,响应为null", request.toString(), "null", creator, receiver, url, false);
                    this.sendErrorMessage("消息ID：" + flowid + "，推送OA待办失败！！，原因：接口调用异常,响应为null,请联系系统管理员！", startUserIds, Name, (Long)startUserIds.get(0), message.getEntityNumber(), message.getId());
                    break;
                }

                JSONObject returnResultObj = JSONObject.fromObject(returnResult);
                if (returnResultObj.containsKey("operResult")) {
                    if (StringUtils.equals("1", returnResultObj.getString("operResult"))) {
                        writeLogByMessage(message, "sendMessage", flowid, "", "消息", returnResultObj.getString("message"), request.toString(), returnResult, creator, receiver, url, true);
                    } else {
                        writeLogByMessage(message, "sendMessage", flowid, "", "消息", returnResultObj.getString("message"), request.toString(), returnResult, creator, receiver, url, false);
                        this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + returnResultObj.getString("message"), startUserIds, Name, (Long)startUserIds.get(0), message.getEntityNumber(), message.getId());
                    }
                    break;
                }
            } catch (Exception var17) {
                ++count;

                try {
                    TimeUnit.MINUTES.sleep(1L);
                } catch (InterruptedException var16) {
                    var16.printStackTrace();
                }

                if (count == 3) {
                    writeLogByMessage(message, "sendMessage", flowid, "", "消息", "接口调用异常" + var17.getMessage(), request.toString(), returnResult, creator, receiver, url, false);
                    this.sendErrorMessage("单据：" + billNumber + "，流程实例ID：" + flowid + "，推送OA待办失败！！，原因：" + var17.getMessage(), startUserIds, Name, (Long)startUserIds.get(0), message.getEntityNumber(), message.getId());
                    break;
                }
            }
        }

    }

    private void sendErrorMessage(String title, List<Long> userIds, String senderName, Long senderId, String entityNumber, Long bizDataId) {
        MessageInfo message = new MessageInfo();
        message.setType("message");
        message.setTitle(title);
        message.setUserIds(userIds);
        message.setSenderName(senderName);
        message.setSenderId(senderId);
        message.setEntityNumber(entityNumber);
        message.setOperation("save");
        message.setBizDataId(bizDataId);
        message.setTag("重要，必读");
        message.setPubaccNumber("flowassist");
        message.setContent(title);

        try {
            Long var8 = MessageCenterServiceHelper.sendMessage(message);
        } catch (Exception var9) {
            var9.printStackTrace();
        }

    }

    private boolean checkOA(String flowid) {
        QFilter qFilter = new QFilter("processinstanceid", "=", flowid);
        DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("WF_HIPROCINST", "billno,entitynumber", new QFilter[]{qFilter});
        if (dynamicObject == null) {
            return false;
        } else {
            return "zjmi_ssc_taskbill".equals(dynamicObject.getString("entitynumber"));
        }
    }

    String postmessage(String context, String users, String username, String workflowId) {
        String message = "";
        String transfer = "<web:userid>" + users + "</web:userid>";
        String billno = "<web:fieldValue>" + context + "</web:fieldValue>";
        String userse = "<web:fieldValue>" + username + "</web:fieldValue>";
        String beforetransfer = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:fron=\"http://localhost/services/FrontWorkflowService\" xmlns:web=\"http://webservices.workflow.weaver\">\n   <soapenv:Header/>\n   <soapenv:Body>\n      <fron:doCreateXXTXWorkflowRequest>\n         <fron:in0>\n            <web:accountType>1</web:accountType>\n            <web:sourcefrom>每刻</web:sourcefrom>";
        String aftertransfer = "<web:workflowRequestInfo>\n               <web:requestName>" + context + "</web:requestName>\n               <web:workflowBaseInfo>\n                  <web:workflowId>" + workflowId + "</web:workflowId>\n               </web:workflowBaseInfo>\n               <web:workflowMainTableInfo>\n                  <web:requestRecords>\n                     <web:WorkflowRequestTableRecord>\n                        <web:workflowRequestTableFields>\n                           <web:WorkflowRequestTableField>\n                              <web:edit>true</web:edit>\n                              <web:fieldName>mdgurl</web:fieldName>";
        String afterbillno = "<web:view>true</web:view>\n                           </web:WorkflowRequestTableField>\n                           <web:WorkflowRequestTableField>\n                              <web:edit>true</web:edit>\n                              <web:fieldName>cs</web:fieldName>\n                              <web:fieldValue></web:fieldValue>\n                              <web:view>true</web:view>\n                           </web:WorkflowRequestTableField>\n\t\t\t\t\t\t   <web:WorkflowRequestTableField>\n                              <web:edit>true</web:edit>\n                              <web:fieldName>jsrzh</web:fieldName>";
        String afteruserse = "<web:view>true</web:view>\n                           </web:WorkflowRequestTableField>\n                        </web:workflowRequestTableFields>\n                     </web:WorkflowRequestTableRecord>\n                  </web:requestRecords>\n               </web:workflowMainTableInfo>\n            </web:workflowRequestInfo>\n         </fron:in0>\n      </fron:doCreateXXTXWorkflowRequest>\n   </soapenv:Body>\n</soapenv:Envelope>";
        message = beforetransfer + transfer + aftertransfer + billno + afterbillno + userse + afteruserse;
        return message;
    }

    String sendOA(String message, String url) throws Exception {
        String result = HttpRequestUtil.requestPost(message, url);
        return result;
    }
}
